package com.example.demo;

/**
 * @Author lizhien (zhien.li@nascent.cn)
 * @Date 2020/8/4 19:47
 * @Version 1.0.0
 * @Description com.example.demo
 */

import com.deliveredtechnologies.rulebook.RuleState;
import com.deliveredtechnologies.rulebook.annotation.Given;
import com.deliveredtechnologies.rulebook.annotation.Result;
import com.deliveredtechnologies.rulebook.annotation.Rule;
import com.deliveredtechnologies.rulebook.annotation.Then;
import com.deliveredtechnologies.rulebook.annotation.When;

@Rule
public class LessRule1 extends RuleParams {

    // 所在部门的员工数
    @Given("num")
    private int num;
    // 所属部门等级
    @Given("deptLevel")
    private String deptLevel;
    // 所在部门排名
    @Given("rank")
    private int rank;

    @Result
    private Response response;

    @When
    public boolean when() {
        return num == 1;
    }

    @Then
    public RuleState then() {
        System.out.println("LessRule1被执行......");
        if (deptLevel == "A") {
            this.response = new Response("A", SCORE_A);
        }
        if (deptLevel == "B") {
            this.response = new Response("B", SCORE_B);
        }
        if (deptLevel == "C") {
            this.response = new Response("C", SCORE_C);
        }
        if (deptLevel == "D") {
            this.response = new Response("D", SCORE_D);
        }
        if (deptLevel == "E") {
            this.response = new Response("E", SCORE_E);
        }

        return RuleState.BREAK;
    }

}
